package com.bocloud.cmp.dao;

import java.util.List;
import java.util.Map;

import com.bocloud.cmp.entity.resource.Image;
import com.bocloud.cmp.model.SimpleImageBean;
import com.bocloud.common.model.Param;
import com.bocloud.common.model.SimpleBean;
import com.bocloud.database.core.intf.GenericDao;

/**
 * 
 * 镜像Image DAO接口
 * 
 * @author DZG
 * @since V1.0 2016年9月12日
 */
public interface ImageDao extends GenericDao<Image, Long> {

	/**
	 * 查询镜像详细
	 * 
	 * @param id
	 *            the id
	 * @return the server
	 * @throws Exception
	 */
	public Image query(Long id) throws Exception;

	/**
	 * 根据镜像ID查询
	 * 
	 * @param imageId
	 * @return
	 * @throws Exception
	 */
	public Image getByImageId(String imageId) throws Exception;

	/**
	 * 查询镜像列表
	 * 
	 * @param page
	 *            the page
	 * @param rows
	 *            the rows
	 * @param params
	 *            the params
	 * @param sorter
	 *            the sorter
	 * @return the result
	 * @throws Exception
	 */
	public List<Image> list(int page, int rows, List<Param> params, Map<String, String> sorter) throws Exception;

	/**
	 * 查询所有
	 * 
	 * @return
	 * @throws Exception
	 */
	public List<Image> list() throws Exception;

	/**
	 * 根据VendorId查询
	 * 
	 * @param vendorId
	 * @return
	 * @throws Exception
	 */
	public List<Image> listByVendorId(Long vendorId) throws Exception;

	/**
	 * 查询镜像简易列表
	 * 
	 * @param params
	 *            the params
	 * @param sorter
	 *            the sorter
	 * @return the bean
	 * @throws Exception
	 */
	public List<SimpleBean> list(List<Param> params, Map<String, String> sorter) throws Exception;

	/**
	 * 查询名称
	 * 
	 * @param id
	 * @param region
	 * @return
	 * @throws Exception
	 */
	public List<SimpleImageBean> listName(Long id, Long region) throws Exception;

	/**
	 * 查询版本
	 * 
	 * @param id
	 * @param reigon
	 * @param name
	 * @return
	 * @throws Exception
	 */
	public List<SimpleImageBean> listVersion(Long id, Long region, String name) throws Exception;

	/**
	 * 查询符合条件的数据数量
	 * 
	 * @param params
	 *            the params
	 * @return count
	 * @throws Exception
	 */
	public int count(List<Param> params) throws Exception;

	/**
	 * 删除镜像
	 * 
	 * @param id
	 *            the id
	 * @param userId
	 *            the user id
	 * @return
	 * @throws Exception
	 */
	public boolean remove(Long id, Long userId) throws Exception;

	/**
	 * 根据云供应商ID删除
	 * 
	 * @param vendorId
	 * @param userId
	 * @return
	 * @throws Exception
	 */
	public boolean removeByVid(Long vendorId, Long userId) throws Exception;

}
